function cuttingRope(n){
    const arr = new Array(n+1).fill(0)
    arr[1] = 1
    arr[2] = 2
    arr[3] = 3
    for (let i = 4; i <= n; i++) {
       for(let j=2; j<4; j++){
           arr[i] = Math.max(arr[i], arr[j] * arr[i-j])
       }
    }
    console.log(arr[n])
}

let n = 10
cuttingRope(10)